set(TRADE_CPYTHON_LIBRARY_VERSION_STRING v1.0.0)
set(TRADE_CPYTHON_LIBRARY_VERSION_EPOCH v1.0.0)
set(TRADE_CPYTHON_LIBRARY_VERSION_MAJOR beta)


include_directories(${PROJECT_SOURCE_DIR}/src/tradecpy/include)
file(GLOB TRADE_CPYTHON_SOURCES
        ${PROJECT_SOURCE_DIR}/src/tradecpy/src/*.cpp
        )
foreach (TRADE_CPYTHON_CPP ${TRADE_CPYTHON_SOURCES})
    message(STATUS "origin ${TRADE_CPYTHON_CPP}")
endforeach ()
add_library(tradecpy_static STATIC ${TRADE_CPYTHON_SOURCES}) #为静态库添加文件
add_library(tradecpy_shared SHARED ${TRADE_CPYTHON_SOURCES}) #为动态库添加文件
link_directories("C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/x64")
target_link_libraries(tradecpy_shared
        #        ${TRADE_TRADE_LIBRARIES}
        ${TRADER_API_LIBRARIES}
        ${PYTHON_LIBS}
        #        SQLiteCpp
        #        sqlite3
        ${PTHREAD_LIBS}
        Kernel32.lib
        )
set_target_properties(tradecpy_static PROPERTIES
        OUTPUT_NAME "tradecpy" #设置输出库的名字
        CLEAN_DIRECT_OUTPUT 1
        #        ARCHIVE_OUTPUT_DIRECTORY staticlib/x64 #设置静态
        )

set_target_properties(tradecpy_shared PROPERTIES
        VERSION ${TRADE_CPYTHON_LIBRARY_VERSION_STRING}
        SOVERSION ${TRADE_CPYTHON_LIBRARY_VERSION_EPOCH}.${TRADE_CPYTHON_LIBRARY_VERSION_MAJOR} #设置库的版本号
        OUTPUT_NAME "tradecpy" #设置输出库的名字
        #        RUNTIME_OUTPUT_DIRECTORY bin/x64 #设置.dll文件的保存路径
        #        ARCHIVE_OUTPUT_DIRECTORY lib/x64
        )

#=====================================================================
file(GLOB TRADE_CPYTHON_EXT_SOURCES
        ${PROJECT_SOURCE_DIR}/src/tradecpy/tradecpt/*.cpp
        )
foreach (TRADE_CPYTHON_EXT_CPP ${TRADE_CPYTHON_EXT_SOURCES})
    message(STATUS "origin ${TRADE_CPYTHON_EXT_CPP}")
endforeach ()
pybind11_add_module(tradecpt ${TRADE_CPYTHON_EXT_SOURCES})
target_link_libraries(tradecpt
        tradecpy_static
        tradecpy_shared
        )